package ls.jpa.chapterC.domain;

import ls.jpa.chapterC.base.AudiTableEntity;

import javax.persistence.*;

/**
 * @author Barudisshu
 */
@Entity
@Table(name = "t_phone", schema = "", catalog = "db_test")
@AttributeOverride(name = "id", column = @Column(name = "phone_id", length = 32))
public class Phone extends AudiTableEntity {

    @Basic
    @Column(name = "phone_number")
    private String phoneNumber;
    @Basic
    @Column(name = "phone_belong",insertable = false,updatable = false)
    private Long phoneBelong;
    @ManyToOne(cascade = CascadeType.PERSIST,targetEntity = Customer.class)
    @JoinColumn(name = "phone_belong",referencedColumnName = "cus_id")
    private Customer customer;

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public Long getPhoneBelong() {
        return phoneBelong;
    }

    public void setPhoneBelong(Long phoneBelong) {
        this.phoneBelong = phoneBelong;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }
}
